package com.itHsuSE.demo3;

import com.itHsuSE.houserent.view.HouseView;

public class Test {
    public static void main1(String[] args) {
        PersonArr personArr=new PersonArr(3);
        Person[] persons=personArr.list();
        for (int i = 0; i < persons.length; i++) {
            System.out.println(persons[i]);
        }
    }

    public static void main(String str[])
    {
        TEst a=new TEst();//无参构造器
    }
}

class Person{
    private String name;

    public Person(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                '}';
    }
}

class PersonArr{
    private Person[] people;

    public PersonArr(int size) {
        people=new Person[size];
    }

    public Person[] list(){
        return people;
    }
}

class Sample
{
    Sample(String s)
    {
        System.out.println(s);
    }
    Sample()
    {
        System.out.println("Sample 默认构造函数被调用");
    }
}

class TEst{
    Sample sam1=new Sample("sam1 成员初始化");//
    static Sample sam=new Sample("静态成员 sam 初始化 ");//
    static{
        System.out.println("static 块执行");//
        if(sam==null)System.out.println("sam is null");
    }
    TEst()//构造器
    {
        System.out.println("Test 默认构造函数被调用");//
    }
}

